#ifndef MYOFFICE_H
#define MYOFFICE_H

#include <QObject>
#include <QPrinter>
#include "globaldef.h"
#include "constants.h"
#include "iexportable.h"

class MyOffice : public QObject
{
    Q_OBJECT
public:
    explicit MyOffice(QObject *parent = nullptr);
    void generateHtml();
    void generateHeaderHtml();
    void generateTailHtml();
    void convert2PDF(const QString & fileName);
    void convert2Doc(const QString & fileName);
    void save2PDF_Doc(const QString& fileName);
    void savePdf(const QString &fileName, const QString &contentHtml);

signals:
    void savePdfSucceedSignal(int);
    void generateAllHtmlSucceedSignal(int type, const QString allHtml);

public slots:
    void savePdfSlot(int type, const QString &fileName, const QString &contentHtml);
    void updatePrintParamSlot();
    void generateAllHtml(int type, const QString _contentHtml);

private:
    void initWidget();
    void readParam();//Read print parameters

private:
    QString allHtml;
    QString headerHtml;
    QString contentHtml;
    QString tailHtml;
    QPrinter::PageSize pageSize;
    bool companyChecked;
    bool equipmentChecked;
    bool serialChecked;
    bool userChecked;
    bool datetimeChecked;
//    int pageSize;
    QString companyName;
    QString equipName;
    QString equipModel;
    QString equipSerial;
    QString username;
    QString datetime;

};

#endif // MYOFFICE_H
